﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UpdateCustomer : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (isLogin())
            {
                tblCustomer cust = LoginedMember;
                txtName.Text = cust.Name;
                txtEmail.Text = cust.Email;
                txtNRIC.Text = cust.NRIC;
                txtContact.Text = cust.Contact;
                txtBlock.Text = cust.Block;
                txtStreet.Text = cust.Street;
                txtCity.Text = cust.City;
                txtProvince.Text = cust.Province;
                ddlCountry.SelectedValue = cust.Country.Value.ToString();
            }
            else
            {
                Response.Redirect("~/index.aspx");
            }
        }
    }
    protected void Submit_Click(object sender, EventArgs e)
    {
        DALCustomer DALcust = new DALCustomer();
        tblCustomer cust = LoginedMember;
        cust.Contact = txtContact.Text ;
        cust.Block = txtBlock.Text;
        cust.Street = txtStreet.Text;
        cust.City = txtCity.Text;
        cust.Province = txtProvince.Text;
        DALcust.updateCustomer(cust);
        LoginedMember = cust;
        Response.Redirect("~/index.aspx");
    }
}